package com.xyht.sca_s.student_manage_system.modules.welcomeNewStudent.controller;


import com.xyht.sca_s.student_manage_system.common.commonReturn.CommonResult;
import com.xyht.sca_s.student_manage_system.common.commonReturn.ResponseResult;
import com.xyht.sca_s.student_manage_system.common.desEncodeAndDecode.annotation.SecretBody;
import com.xyht.sca_s.student_manage_system.modules.welcomeNewStudent.entity.req.SmsWnsRegistrationProcessReq;
import com.xyht.sca_s.student_manage_system.modules.welcomeNewStudent.service.SmsWnsRegistrationProcessService;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Arrays;

/**
 * <p>
 * 报到流程步骤表 前端控制器
 * </p>
 *
 * @author XYHT
 * @since 2024-01-08
 */
@RestController
@SecretBody
@RequestMapping("/welcomeNewStudent/process")
public class SmsWnsRegistrationProcessController {
    @Resource
    private SmsWnsRegistrationProcessService smsWnsRegistrationProcessService;

    @ApiModelProperty("添加报到流程步骤")
    @PostMapping("/add")
    public ResponseResult addProcess(@RequestBody SmsWnsRegistrationProcessReq processReq) {
        return smsWnsRegistrationProcessService.addProcess(processReq);
    }

    @ApiModelProperty("删除报到流程步骤")
    @PostMapping("/del")
    public ResponseResult delProcess(@RequestParam("processId") String[] processId) {
        smsWnsRegistrationProcessService.removeByIds(Arrays.asList(processId));
        return CommonResult.success();
    }

    @ApiModelProperty("修改报到流程步骤")
    @PostMapping("/update")
    public ResponseResult updateProcess(@RequestBody SmsWnsRegistrationProcessReq processReq) {
        return smsWnsRegistrationProcessService.updateProcess(processReq);
    }

    @ApiModelProperty("报到流程步骤列表")
    @GetMapping("/list")
    public ResponseResult listProcess(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                      @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
                                      @RequestParam(value = "searchStr", required = false) String searchStr) {
        return smsWnsRegistrationProcessService.listProcess(pageNum, pageSize, searchStr);
    }

    @ApiModelProperty("报到流程步骤详情")
    @GetMapping("/detail")
    public ResponseResult processDetail(@RequestParam("processId") String processId) {
        return smsWnsRegistrationProcessService.processDetail(processId);
    }
}

